package com.tbit.uqbike.object.pojo.vo;

import com.tbit.uqbike.annos.Excel;
import com.tbit.uqbike.object.pojo.RefundAdapayRecord;
import com.tbit.uqbike.webmanager.util.csv.annotations.Csv;
import lombok.Data;

/**
 * 分账退款详情
 *
 * @author <a href="mailto:chen.wutian@tbit.com.cn">BUGTian</a>
 * @since 2024/11/25
 */
@Data
public class RefundAdapayRecordVO extends RefundAdapayRecord {

    /**
     * 区域名称
     */
    @Excel(name = "区域", sort = 2)
    @Csv(name = "区域")
    private String areaName;

    /**
     * 账号名称
     */
    @Excel(name = "账号", sort = 8)
    @Csv(name = "账号")
    private String nickName;

    /**
     * 退款总金额（单位：元）
     */
    @Excel(name = "退款金额", sort = 5)
    @Csv(name = "退款金额")
    private String totalRefundMoneyYuan;

    /**
     * 本次退款金额（单位：元）
     */
    @Excel(name = "汇付退款", sort = 10)
    @Csv(name = "汇付退款")
    private String refundMoneyYuan;

    /**
     * 退款手续费（三方支付系统收取）单位：元
     */
    @Excel(name = "退款汇付手续费", sort = 7)
    @Csv(name = "退款汇付手续费")
    private String refundFeeYuan;

    /**
     * 退款服务费（我们平台收取）单位：元
     */
    @Excel(name = "退款平台服务费(所有平台汇总)", sort = 6)
    @Csv(name = "退款平台服务费(所有平台汇总)")
    private String refundServiceFeeYuan;

    /**
     * 单位转换
     */
    public void unitConversion() {
        this.totalRefundMoneyYuan = getTotalRefundMoney() == 0D ? "0" : String.format("%.2f", (getTotalRefundMoney() / 100D));
        this.refundMoneyYuan = getRefundMoney() == 0D ? "0" : String.format("%.2f", (getRefundMoney() / 100D));
        this.refundFeeYuan = getRefundFee() == 0D ? "0" : String.format("%.2f", ((double) getRefundFee() / 100D));
        this.refundServiceFeeYuan = getRefundServiceFee() == 0D ? "0" : String.format("%.2f", ((double) getRefundServiceFee() / 100D));
    }
}
